package com.io;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;

public class ReaderText {

	public static void main(String[] args) {
		Reader reader=null;
		Writer writer=null;
		char[] data=new char[1024];
		try {
			 reader=new FileReader(":/text1.txt");
			 writer=new FileWriter("e:text.txt");
			int read = 0;
			while ((read=reader.read(data))>=0) {
				String string =new String(data,0,read);
				writer.write(data, 0, read);
				System.out.println(string.length());
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			try {
				reader.close();
				writer.close();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

}
